package com.jeethink.gs.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import com.jeethink.common.core.domain.AjaxResult;
import com.jeethink.common.core.domain.entity.SysUser;
import com.jeethink.common.utils.DateUtils;
import com.jeethink.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeethink.gs.mapper.GsTaskReportFormMapper;
import com.jeethink.gs.domain.GsTaskReportForm;
import com.jeethink.gs.service.GsTaskReportFormService;
import com.jeethink.common.core.text.Convert;
import org.springframework.web.multipart.MultipartFile;

/**
 * 任务报Service业务层处理
 * 
 * @author jeethink
 * @date 2022-08-10
 */
@Service
public class GsTaskReportFormServiceImpl implements GsTaskReportFormService
{
    @Autowired
    private GsTaskReportFormMapper gsTaskReportFormMapper;

    /**
     * 查询任务报
     * 
     * @param id 任务报ID
     * @return 任务报
     */
    @Override
    public GsTaskReportForm selectGsTaskReportFormById(String id)
    {
        return gsTaskReportFormMapper.selectGsTaskReportFormById(id);
    }

    /**
     * 查询任务报列表
     * 
     * @param gsTaskReportForm 任务报
     * @return 任务报
     */
    @Override
    public List<GsTaskReportForm> selectGsTaskReportFormList(GsTaskReportForm gsTaskReportForm)
    {
        return gsTaskReportFormMapper.selectGsTaskReportFormList(gsTaskReportForm);
    }

    /**
     * 新增任务报
     * 
     * @param gsTaskReportForm 任务报
     * @return 结果
     */
    @Override
    public int insertGsTaskReportForm(GsTaskReportForm gsTaskReportForm)
    {
        String uuid = UUID.randomUUID().toString();
        SysUser sysUser = ShiroUtils.getSysUser();
        gsTaskReportForm.setId(uuid);
        gsTaskReportForm.setCreateUser(sysUser.getUserId().toString());
        gsTaskReportForm.setCreateTime(DateUtils.getNowDate());
        gsTaskReportForm.setDelFlag("0");
        return gsTaskReportFormMapper.insertGsTaskReportForm(gsTaskReportForm);
    }

    /**
     * 修改任务报
     * 
     * @param gsTaskReportForm 任务报
     * @return 结果
     */
    @Override
    public int updateGsTaskReportForm(GsTaskReportForm gsTaskReportForm)
    {
        return gsTaskReportFormMapper.updateGsTaskReportForm(gsTaskReportForm);
    }

    /**
     * 删除任务报对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGsTaskReportFormByIds(String ids)
    {
        return gsTaskReportFormMapper.deleteGsTaskReportFormByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除任务报信息
     * 
     * @param id 任务报ID
     * @return 结果
     */
    @Override
    public int deleteGsTaskReportFormById(String id)
    {
        return gsTaskReportFormMapper.deleteGsTaskReportFormById(id);
    }

    /**
     * 历史文件
     * @author Hyunjin
     * @date 16:02 2022/8/10
     * @param name
     * @return com.jeethink.gs.domain.GsTaskReportForm
     **/
    @Override
    public List<GsTaskReportForm> selReportFormByUser(String name) {
        SysUser sysUser = ShiroUtils.getSysUser();
        return gsTaskReportFormMapper.selReportFormByUser(sysUser.getUserId().toString(),name);
    }


}
